#include <bits/stdc++.h>
using namespace std;
int n;
map<string,int> dup;
string s;
map<char,char> toc;
int main(void){
    toc['A']=toc['B']=toc['C']='2';
    toc['D']=toc['E']=toc['F']='3';
    toc['G']=toc['H']=toc['I']='4';
    toc['J']=toc['K']=toc['L']='5';
    toc['M']=toc['N']=toc['O']='6';
    toc['P']=toc['R']=toc['S']='7';
    toc['T']=toc['U']=toc['V']='8';
    toc['W']=toc['X']=toc['Y']='9';
    while(~scanf("%d",&n)){
        dup.clear();
        for(int i=0;i<n;i++){
            cin >> s;
            string t="";
            int l=s.size();
            int cnt=0;
            for(int j=0;j<l;j++){
                //printf("%d\n",s[j]>='0');
                if(cnt==3){
                    t+="-";
                    cnt++;
                }
                if(s[j]=='-'){
                    continue;
                }
                if(s[j]>='0' && s[j]<='9'){
                    t+=s[j];
                    cnt++;
                }else if(s[j]>='A' && s[j]<='Z' && s[j]!='Q' && s[j]!='Z'){
                    t+=toc[s[j]];
                    cnt++;
                }
            }
            //cout << t << endl;
            dup[t]++;
        }
        int g=dup.size();
        if(g==0){
            printf("No duplicates.\n");
        }else{
            bool flag=true;
            map<string,int>::iterator it=dup.begin();
            for(;it!=dup.end();it++){
                if(it->second==1){
                    continue;
                }
                flag=false;
                cout << it->first <<" " << it->second << endl;
            }
            if(flag){
                printf("No duplicates.\n");
            }
        }
    }
    return 0;
}